import { getActivityLog } from '../services/activityLog';

export default {
  namespace: 'activityLog',

  state: {
    dataSource: [],
    current: 1,
    pageSize: 10,
    total: 0,
  },

  effects: {
    * getDataSource(action, { call, put }) {
      try {
        const res = yield call(getActivityLog);
        console.log('res', res);
        yield put({ type: 'getDataSourceDone', payload: res });
      } catch (e) {
        console.error(e);
      }
    },
  },

  reducers: {
    getDataSourceDone(state, { payload }) {
      return { ...state, ...payload };
    },
  },
};
